home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 April: Mac OS SDK / Dev.CD Apr 97 SDK1.toast / Development Kits (Disc 1) / Interfaces&Libraries / Interfaces / PInterfaces / DriverGestalt.p < prev    next >
Encoding:
Text File  |  1996-09-22  |  10.4 KB  |  284 lines  |  [TEXT/MPS ]

  1. {
  2.      File:        DriverGestalt.p
  3.  
  4.      Contains:    Driver Gestalt interfaces
  5.  
  6.      Version:    Technology:    PowerSurge 1.0.2.
  7.                  Package:    Universal Interfaces 2.1.4
  8.  
  9.      Copyright:    © 1984-1996 by Apple Computer, Inc.
  10.                  All rights reserved.
  11.  
  12.      Bugs?:        If you find a problem with this file, use the Apple Bug Reporter
  13.                  stack.  Include the file and version information (from above)
  14.                  in the problem description and send to:
  15.                      Internet:    apple.bugs@applelink.apple.com
  16.                      AppleLink:    APPLE.BUGS
  17.  
  18. }
  19.  
  20. {$IFC UNDEFINED UsingIncludes}
  21. {$SETC UsingIncludes := 0}
  22. {$ENDC}
  23.  
  24. {$IFC NOT UsingIncludes}
  25.  UNIT DriverGestalt;
  26.  INTERFACE
  27. {$ENDC}
  28.  
  29. {$IFC UNDEFINED __DRIVERGESTALT__}
  30. {$SETC __DRIVERGESTALT__ := 1}
  31.  
  32. {$I+}
  33. {$SETC DriverGestaltIncludes := UsingIncludes}
  34. {$SETC UsingIncludes := 1}
  35.  
  36. {$IFC UNDEFINED __TYPES__}
  37. {$I Types.p}
  38. {$ENDC}
  39. {$IFC UNDEFINED __OSUTILS__}
  40. {$I OSUtils.p}
  41. {$ENDC}
  42. {$IFC UNDEFINED __SCSI__}
  43. {$I SCSI.p}
  44. {$ENDC}
  45.  
  46. {$PUSH}
  47. {$ALIGN MAC68K}
  48. {$LibExport+}
  49.  
  50. { __________________________________________________________________________________ }
  51. {  The Driver Gestalt bit in the dCtlFlags  }
  52.  
  53. CONST
  54.     kbDriverGestaltEnable        = 2;
  55.     kmDriverGestaltEnableMask    = $04;
  56.  
  57. { __________________________________________________________________________________ }
  58. {  Driver Gestalt related csCodes  }
  59.     kDriverGestaltCode            = 43;                            {  various uses  }
  60.     kDriverConfigureCode        = 43;                            {  various uses  }
  61.     kdgLowPowerMode                = 70;                            {  Sets/Returns the current energy consumption level  }
  62.     kdgReturnDeviceID            = 120;                            {  returns SCSI DevID in csParam[0]  }
  63.     kdgGetCDDeviceInfo            = 121;                            {  returns CDDeviceCharacteristics in csParam[0]  }
  64.  
  65. { __________________________________________________________________________________ }
  66. {  Driver Gestalt selectors  }
  67.     kdgVersion                    = 'vers';                        {  Version number of the driver in standard Apple format  }
  68.     kdgDeviceType                = 'devt';                        {  The type of device the driver is driving.  }
  69.     kdgInterface                = 'intf';                        {  The underlying interface that the driver is using (if any)  }
  70.     kdgSync                        = 'sync';                        {  True if driver only behaves synchronously.  }
  71.     kdgBoot                        = 'boot';                        {  value to place in PRAM for this drive (long)  }
  72.     kdgWide                        = 'wide';                        {  True if driver supports ioWPosOffset  }
  73.     kdgPurge                    = 'purg';                        {  Driver purge permission (True = purge; False = no purge)  }
  74.     kdgSupportsSwitching        = 'lpwr';                        {  True if driver supports power switching  }
  75.     kdgMin3VPower                = 'pmn3';                        {  Minimum 3.3V power consumption in microWatts  }
  76.     kdgMin5VPower                = 'pmn5';                        {  Minimum 5V power consumption in microWatts  }
  77.     kdgMax3VPower                = 'pmx3';                        {  Maximum 3.3V power consumption in microWatts  }
  78.     kdgMax5VPower                = 'pmx5';                        {  Maximum 5V power consumption in microWatts  }
  79.     kdgInHighPower                = 'psta';                        {  True if device is currently in high power mode  }
  80.     kdgSupportsPowerCtl            = 'psup';                        {  True if driver supports following five calls  }
  81.     kdgAPI                        = 'dAPI';                        {  API support for PC Exchange  }
  82.     kdgEject                    = 'ejec';                        {  Eject options for shutdown/restart <2/03/95>  }
  83.  
  84. { __________________________________________________________________________________ }
  85. {  status parameter block for Driver Gestalt calls  }
  86.  
  87. TYPE
  88.     DriverGestaltParamPtr = ^DriverGestaltParam;
  89.     DriverGestaltParam = RECORD
  90.         qLink:                    QElemPtr;
  91.         qType:                    INTEGER;
  92.         ioTrap:                    INTEGER;
  93.         ioCmdAddr:                Ptr;
  94.         ioCompletion:            ProcPtr;
  95.         ioResult:                OSErr;
  96.         ioNamePtr:                StringPtr;
  97.         ioVRefNum:                INTEGER;
  98.         ioCRefNum:                INTEGER;                                {  refNum for I/O operation  }
  99.         csCode:                    INTEGER;                                {     == kDriverGestaltCode  }
  100.         driverGestaltSelector:    OSType;                                    {  'sync', 'vers', etc.  }
  101.         driverGestaltResponse:    UInt32;                                    {  Could be a pointer, bit field or other format  }
  102.         driverGestaltResponse1:    UInt32;                                    {  Could be a pointer, bit field or other format  }
  103.         driverGestaltResponse2:    UInt32;                                    {  Could be a pointer, bit field or other format  }
  104.         driverGestaltResponse3:    UInt32;                                    {  Could be a pointer, bit field or other format  }
  105.         driverGestaltfiller:    UInt16;                                    {  To pad out to the size of a controlPB  }
  106.     END;
  107.  
  108. {
  109.  Note that the various response definitions are overlays of the response fields above.
  110.    For instance the deviceType response would be returned in driverGestaltResponse.
  111.    The DriverGestaltPurgeResponse would be in driverGestaltResponse and driverGestaltResponse1
  112. }
  113. { __________________________________________________________________________________ }
  114. {  Device Types response  }
  115.     DriverGestaltDevTResponsePtr = ^DriverGestaltDevTResponse;
  116.     DriverGestaltDevTResponse = RECORD
  117.         deviceType:                OSType;
  118.     END;
  119.  
  120.  
  121. CONST
  122.     kdgDiskType                    = 'disk';                        {  standard r/w disk drive  }
  123.     kdgTapeType                    = 'tape';                        {  tape drive  }
  124.     kdgPrinterType                = 'prnt';                        {  printer  }
  125.     kdgProcessorType            = 'proc';                        {  processor  }
  126.     kdgWormType                    = 'worm';                        {  write-once  }
  127.     kdgCDType                    = 'cdrm';                        {  cd-rom drive  }
  128.     kdgFloppyType                = 'flop';                        {  floppy disk drive  }
  129.     kdgScannerType                = 'scan';                        {  scanner  }
  130.     kdgFileType                    = 'file';                        {  Logical Partition type based on a file (Drive Container)  }
  131.     kdgRemovableType            = 'rdsk';                        {  A removable media hard disk drive ie. Syquest, Bernioulli  }
  132.  
  133. { __________________________________________________________________________________ }
  134. {  Device Interfaces response  }
  135.  
  136. TYPE
  137.     DriverGestaltIntfResponsePtr = ^DriverGestaltIntfResponse;
  138.     DriverGestaltIntfResponse = RECORD
  139.         interfaceType:            OSType;
  140.     END;
  141.  
  142.  
  143. CONST
  144.     kdgScsiIntf                    = 'scsi';
  145.     kdgPcmciaIntf                = 'pcmc';
  146.     kdgATAIntf                    = 'ata ';
  147.     kdgFireWireIntf                = 'fire';
  148.     kdgExtBus                    = 'card';
  149.  
  150. { __________________________________________________________________________________ }
  151. {  Power Saving  }
  152.  
  153. TYPE
  154.     DriverGestaltPowerResponsePtr = ^DriverGestaltPowerResponse;
  155.     DriverGestaltPowerResponse = RECORD
  156.         powerValue:                LONGINT;                                {  Power consumed in µWatts  }
  157.     END;
  158.  
  159. { __________________________________________________________________________________ }
  160. {  Disk Specific  }
  161.     DriverGestaltSyncResponsePtr = ^DriverGestaltSyncResponse;
  162.     DriverGestaltSyncResponse = RECORD
  163.         behavesSynchronously:    BOOLEAN;
  164.         pad:                    PACKED ARRAY [0..2] OF UInt8;
  165.     END;
  166.  
  167.     DriverGestaltBootResponsePtr = ^DriverGestaltBootResponse;
  168.     DriverGestaltBootResponse = RECORD
  169.         extDev:                    SInt8;                                    {   Packed target (upper 5 bits) LUN (lower 3 bits)  }
  170.         partition:                SInt8;                                    {   Unused  }
  171.         SIMSlot:                SInt8;                                    {   Slot  }
  172.         SIMsRSRC:                SInt8;                                    {   sRsrcID  }
  173.     END;
  174.  
  175.     DriverGestaltAPIResponsePtr = ^DriverGestaltAPIResponse;
  176.     DriverGestaltAPIResponse = RECORD
  177.         partitionCmds:            INTEGER;                                {  if bit 0 is nonzero, supports partition control and status calls  }
  178.                                                                         {          prohibitMounting (control, kProhibitMounting)  }
  179.                                                                         {          partitionToVRef (status, kGetPartitionStatus)  }
  180.                                                                         {          getPartitionInfo (status, kGetPartInfo)  }
  181.         unused1:                INTEGER;                                {  all the unused fields should be zero  }
  182.         unused2:                INTEGER;
  183.         unused3:                INTEGER;
  184.         unused4:                INTEGER;
  185.         unused5:                INTEGER;
  186.         unused6:                INTEGER;
  187.         unused7:                INTEGER;
  188.         unused8:                INTEGER;
  189.         unused9:                INTEGER;
  190.         unused10:                INTEGER;
  191.     END;
  192.  
  193. {  Flags for purge permissions  }
  194.  
  195. CONST
  196.     kbCloseOk                    = 0;                            {  Ok to call Close  }
  197.     kbRemoveOk                    = 1;                            {  Ok to call RemoveDrvr  }
  198.     kbPurgeOk                    = 2;                            {  Ok to call DisposePtr  }
  199.     kmNoCloseNoPurge            = 0;
  200.     kmOkCloseNoPurge            = $03;
  201.     kmOkCloseOkPurge            = $07;
  202.  
  203. {  Driver purge permission structure  }
  204.  
  205. TYPE
  206.     DriverGestaltPurgeResponsePtr = ^DriverGestaltPurgeResponse;
  207.     DriverGestaltPurgeResponse = RECORD
  208.         purgePermission:        UInt16;                                    {  0 = Do not change the state of the driver  }
  209.                                                                         {  3 = Do Close() and DrvrRemove() this driver  }
  210.                                                                         {  but don't deallocate driver code  }
  211.                                                                         {  7 = Do Close(), DrvrRemove(), and DisposePtr()  }
  212.         purgeReserved:            UInt16;
  213.         purgeDriverPointer:        Ptr;                                    {  pointer to the start of the driver block (valid  }
  214.                                                                         {  only of DisposePtr permission is given  }
  215.     END;
  216.  
  217.     DriverGestaltEjectResponsePtr = ^DriverGestaltEjectResponse;
  218.     DriverGestaltEjectResponse = RECORD
  219.         ejectFeatures:            UInt32;                                    {    }
  220.     END;
  221.  
  222. {  Flags for Ejection Features field  }
  223.  
  224. CONST
  225.     kRestartDontEject            = 0;                            {  Dont Want eject during Restart  }
  226.     kShutDownDontEject            = 1;                            {  Dont Want eject during Shutdown  }
  227.     kRestartDontEject_Mask        = $01;
  228.     kShutDownDontEject_Mask        = $02;
  229.  
  230. { __________________________________________________________________________________ }
  231. {  CD-ROM Specific  }
  232. {
  233.  The CDDeviceCharacteristics result is returned in csParam[0] and csParam[1] of a 
  234.    standard CntrlParam parameter block called with csCode kdgGetCDDeviceInfo.
  235. }
  236.  
  237. TYPE
  238.     CDDeviceCharacteristicsPtr = ^CDDeviceCharacteristics;
  239.     CDDeviceCharacteristics = RECORD
  240.         speedMajor:                SInt8;                                    {  High byte of fixed point number containing drive speed  }
  241.         speedMinor:                SInt8;                                    {  Low byte of "" CD 300 == 2.2, CD_SC == 1.0 etc.  }
  242.         cdFeatures:                UInt16;                                    {  Flags field for features and transport type of this CD-ROM  }
  243.     END;
  244.  
  245.  
  246. CONST
  247.     cdFeatureFlagsMask            = $FFFC;                        {  The Flags are in the first 14 bits of the cdFeatures field  }
  248.     cdTransportMask                = $0003;                        {  The transport type is in the last 2 bits of the cdFeatures field  }
  249.  
  250. {  Flags for CD Features field  }
  251.     cdMute                        = 0;                            {  The following flags have the same bit number  }
  252.     cdLeftToChannel                = 1;                            {  as the Audio Mode they represent.  Don't change  }
  253.     cdRightToChannel            = 2;                            {  them without changing dControl.c  }
  254.     cdLeftPlusRight                = 3;                            {  Reserve some space for new audio mixing features (4-7)  }
  255.     cdSCSI_2                    = 8;                            {  Supports SCSI2 CD Command Set  }
  256.     cdStereoVolume                = 9;                            {  Can support two different volumes (1 on each channel)  }
  257.     cdDisconnect                = 10;                            {  Drive supports disconnect/reconnect  }
  258.     cdWriteOnce                    = 11;                            {  Drive is a write/once (CD-R?) type drive  }
  259.     cdMute_Mask                    = $01;
  260.     cdLeftToChannel_Mask        = $02;
  261.     cdRightToChannel_Mask        = $04;
  262.     cdLeftPlusRight_Mask        = $08;
  263.     cdSCSI_2_Mask                = $0100;
  264.     cdStereoVolume_Mask            = $0200;
  265.     cdDisconnect_Mask            = $0400;
  266.     cdWriteOnce_Mask            = $0800;
  267.  
  268. {  Transport types  }
  269.     cdCaddy                        = 0;                            {  CD_SC,CD_SC_PLUS,CD-300 etc.  }
  270.     cdTray                        = 1;                            {  CD_300_PLUS etc.  }
  271.     cdLid                        = 2;                            {  Power CD - eg no eject mechanism  }
  272.  
  273.  
  274. {$ALIGN RESET}
  275. {$POP}
  276.  
  277. {$SETC UsingIncludes := DriverGestaltIncludes}
  278.  
  279. {$ENDC} {__DRIVERGESTALT__}
  280.  
  281. {$IFC NOT UsingIncludes}
  282.  END.
  283. {$ENDC}
  284.